/*
 *reference: 
 * http://www.learncpp.com/cpp-tutorial/911-the-copy-constructor-and-overloading-the-assignment-operator/
 * http://www.tutorialspoint.com/cplusplus/cpp_copy_constructor.htm
 *
 */

#include <iostream>
#define PI 3.1416

using namespace std;

class Circle_1
{
    public:
        Circle_1()
        {
            this->radius = 0;
            pIntArray = new int[2];
            pIntArray[0] = 10;
            pIntArray[1] = 10;
        }

        Circle_1(double radius)
        {
            this->radius = radius;
            pIntArray = new int[2];
            pIntArray[0] = 10;
            pIntArray[1] = 10;

        }

        double getRadius() { return radius; }
        void setRadius(double radius) { this->radius = radius; }
        double getArea() { return PI * radius * radius; }
        int * getIntArray() { return pIntArray; }
        void setIntArray(int *pIntArray) { this->pIntArray = pIntArray; }

    private:
        double radius;
        int *pIntArray;
};

int main()
{
    Circle_1 circle_1;
    cout << "circle_1.getRadius() = " << circle_1.getRadius() << endl; 
    Circle_1 circle_2(3);
    cout << "circle_2.getRadius() = " << circle_2.getRadius() << endl;
    cout << "circle_1.getIntArray()[0] = " << circle_1.getIntArray()[0] << endl;
    cout << "circle_1.getIntArray()[1] = " << circle_1.getIntArray()[1] << endl;

    //shallow copy
    Circle_1 circle_3 = circle_2;
    cout << "shallow copy: Circle_1 circle_3 = circle_2;" << endl;
    cout << "circle_3.getRadius() = " << circle_3.getRadius() << endl;
    circle_2.setRadius(4.00);
    cout << "circle_2.setRadius(4.00);" << endl;
    cout << "circle_3.getRadius() = " << circle_3.getRadius() << endl;


    return 0;
}
